<h1>{{ datename }}</h1>
<a href="{% url "booktahoe.views.month" year month %}"> Back to calendar </a>
{% if form %}
<form action="/nights/{{ night.id }}/book/" method="post">
{% csrf_token %}
 {{ form.as_p }}
 <p> One guest per line </p>
 <input type="submit" value="Update" />
</form>
{% endif %}
<h2> Members ({{night.attendees.count}})</h2>
<ul>
{% for a in attends %}
    <li>{{ a.member.username }}
    {% if a.parkingRequests > 0 %}
    + {{a.parkingRequests}} car
    {% endif %}
    </li>
{% endfor %}
</ul>

<h2> Guests ({{guestList|length}})</h2>
<ul>
{% for guest in guestList %}
	<li>{{ guest }}</li>
{% endfor %}
</ul>
<h2 id="c"> Comments </h2>
{% for comment in night.comment_set.all %}

    {% if comment.id == commentId %}
    	<form id="c{{comment.id}}" action="{% url "booktahoe.views.editComment" commentId %}" method="post">
		{% csrf_token %}
		<textarea rows="6" cols="60" name="commentText">{{comment.text}}</textarea>
		<input type="submit" value="Update" />
		</form>
    {% else %}
    <p id="c{{comment.id}}">
    	{{comment.poster.username}} - {{comment.text}}
    	{% if comment.poster == user %}
    	<a href="{% url "booktahoe.views.detail" year month day comment.id %}#c{{comment.id}}">edit</a>
    	<a href="{% url "booktahoe.views.deleteComment" comment.id %}#c">delete</a>
    	    </p>
    {% endif %}

    {% endif %}
{% endfor %}
</br>
{% if form %}
<form action="{% url "booktahoe.views.comment" night.id %}" method="post">
{% csrf_token %}
<textarea rows="6" cols="60" name="commentText">
</textarea>
<input type="submit" value="Comment" />
</form>
{% endif %}